import 'package:flutter/material.dart';
import 'package:flutter_base_widget/base/base.dart';

class LayoutBuilderScreen extends BasePage {

  Widget _createList() {
    return Container(
      child: ListView.builder(
              itemCount: 20,
              itemBuilder: (context, index){
                return Container(
                  child: Padding(
                    padding: const EdgeInsets.all(20.0),
                    child: Text("---$index"),
                  ),
                );
              },
            ),
    );
  }

  @override
  Widget rebuild(BuildContext context) {
    return Container(
      child: LayoutBuilder(
        builder: (context, constraints){
          if(constraints.maxWidth < 400) {
            return _createList();
          } else {
            return Container(
              child: Row(
                children: <Widget>[
                  Flexible(
                    flex: 1,
                    child: _createList(),
                  ),
                  Flexible(
                    flex: 1,
                    child: _createList(),
                  ),
                ],
              ),
            );
          }
        },
      ),
    );
  }
}